package a66weding.com.jiehuntong.view;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;

import a66weding.com.jiehuntong.R;

/**
 * 作者：刘dongxu
 */
public class PublishPopWindow extends PopupWindow {


    private final EditText addtitle_et;
    private final ImageView addcover_iv;
    private TextView tvAddfengmian, tvIspublic;
    private View mMenuView;

    public PublishPopWindow(Activity context, OnClickListener itemsOnClick) {
        super(context);
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        mMenuView = inflater.inflate(R.layout.activity_tools_publishpop, null);

        addtitle_et = (EditText) mMenuView.findViewById(R.id.addtitle_edittext);
        tvAddfengmian = (TextView) mMenuView.findViewById(R.id.tv_addfengmian);
        addcover_iv = (ImageView) mMenuView.findViewById(R.id.addcover_imageview);
        tvIspublic = (TextView) mMenuView.findViewById(R.id.tv_ispublic);

        //设置按钮监听
        addtitle_et.setOnClickListener(itemsOnClick);
        tvAddfengmian.setOnClickListener(itemsOnClick);
        addcover_iv.setOnClickListener(itemsOnClick);
        tvIspublic.setOnClickListener(itemsOnClick);
        //设置SelectPicPopupWindow的View
        this.setContentView(mMenuView);
        //设置SelectPicPopupWindow弹出窗体的宽
        this.setWidth(LayoutParams.MATCH_PARENT);
        //设置SelectPicPopupWindow弹出窗体的高
        this.setHeight(LayoutParams.MATCH_PARENT);
        //设置SelectPicPopupWindow弹出窗体可点击
        this.setFocusable(true);
        //设置SelectPicPopupWindow弹出窗体动画效果
        this.setAnimationStyle(R.style.AnimBottom);
        //实例化一个ColorDrawable颜色为半透明
        ColorDrawable dw = new ColorDrawable(0x10000000);
        //设置SelectPicPopupWindow弹出窗体的背景
        this.setBackgroundDrawable(dw);

    }

}